home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1993 July / Internet Tools.iso / RockRidge / info-service / gopher / Unix / go4gw1.1 / g2snmp < prev    next >
Encoding:
Text File  |  1993-04-30  |  15.8 KB  |  558 lines

  1. #!/usr/local/bin/perl
  2. ###################################################
  3. #
  4. # Standard RCS Header information (see co(1))
  5. #
  6. # lindner
  7. #
  8. # 1993/04/30 16:30:42
  9. #
  10. # 1.1.1.1
  11. #
  12. #
  13. # /home/mudhoney/GopherSrc/CVS/go4gw/g2snmp,v
  14. #
  15. # Exp
  16. #
  17. # g2snmp,v
  18. # Revision 1.1.1.1  1993/04/30  16:30:42  lindner
  19. # initial cvsing of go4gw
  20. #
  21. # Revision 1.1  1992/10/08  21:48:02  schemers
  22. # Initial revision
  23. #
  24. #--------------------------------------------------
  25. # Copyright (c) 1992 Board of Trustees
  26. #            Leland Stanford Jr. University
  27. ###################################################
  28. # /*
  29. #  * Redistribution and use in source and binary forms are permitted
  30. #  * provided that the above copyright notice and this paragraph are
  31. #  * duplicated in all such forms and that any documentation,
  32. #  * advertising materials, and other materials related to such
  33. #  * distribution and use acknowledge that the software was developed
  34. #  * by Stanford University.  The name of the University may not be used 
  35. #  * to endorse or promote products derived from this software without 
  36. #  * specific prior written permission.
  37. #  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
  38. #  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  39. #  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  40. #  */
  41. #----------------------------------------------------------------------
  42. # variables you should change:
  43.  
  44. $snmp_table = "/usr/local/bin/snmp-table";
  45.  
  46. #----------------------------------------------------------------------
  47.  
  48.  
  49. sub snmp_main {
  50.  local($_) = @_;
  51.  
  52.  if (/^$/) {
  53.     &Greply("7SNMP Agent\t$Ggw menu\t$Ghost\t$Gport");
  54.     &Greply(".");
  55.     exit(0);
  56.  }
  57.  
  58. if (/^menu\s+(.*)/i)         {  &do_menu($1);  } 
  59. elsif (/^at\s+(.*)/i)        {  &dump_at($1); }
  60. elsif (/^system\s+(.*)/i)    {  &dump_system($1); }
  61. elsif (/^interface\s+(.*)/i) {  &dump_interface($1); }
  62. elsif (/^ip\s+(.*)/i) {  &dump_ip($1); }
  63. elsif (/^icmp\s+(.*)/i) {  &dump_icmp($1); }
  64. elsif (/^tcp\s+(.*)/i) {  &dump_tcp($1); }
  65. elsif (/^udp\s+(.*)/i) {  &dump_udp($1); }
  66. else {
  67.   &Gabort("Unknown command!");
  68.   exit;
  69. }
  70.  
  71. }
  72.  
  73. sub do_menu {
  74.     local($agent)=@_;
  75.     &Greply("0Address Translation Group\t$Ggw at $agent\t$Ghost\t$Gport");
  76.     &Greply("0Interface Group\t$Ggw interface $agent\t$Ghost\t$Gport");
  77.     &Greply("0ICMP Group\t$Ggw icmp $agent\t$Ghost\t$Gport");
  78.     &Greply("0IP Group\t$Ggw ip $agent\t$Ghost\t$Gport");
  79.     &Greply("0System Group\t$Ggw system $agent\t$Ghost\t$Gport");
  80.     &Greply("0TCP Group\t$Ggw tcp $agent\t$Ghost\t$Gport");
  81.     &Greply("0UDP Group\t$Ggw udp $agent\t$Ghost\t$Gport");
  82.     &Greply(".");
  83.     exit(0);
  84. }
  85.  
  86.  
  87. chop($date=`date`);
  88.  
  89. %ifType2a = (
  90.         1, 'other',
  91.         2, 'regular1822',
  92.     3, 'hdh1822',
  93.     4, 'ddn-x25',
  94.     5, 'rfc877-x25',
  95.     6, 'ethernet-csmacd',
  96.     7, 'iso88023-csmacd',
  97.     8, 'iso88024-tokenBus',
  98.     9, 'iso88025-tokenRing',
  99.     10,' iso88026-man',
  100.     11,' starLan',
  101.     12,' proteon-10Mbit',
  102.     13,' proteon-80Mbit',
  103.     14,' hyperchannel',
  104.     15,' fddi',
  105.     16,' lapb',
  106.     17,' sdlc',
  107.     18,' ds1',
  108.     19,' e1',
  109.     20,' basicISDN',
  110.     21,' primaryISDN',
  111.     22,' propPointToPointSerial',
  112.     23,' ppp',
  113.     24,'softwareLoopback',
  114.     25,' eon,',
  115.     26,' ethernet-3Mbit',
  116.     27,' nsip',
  117.     28,' slip',
  118.     29,' ultra',
  119.     30,' ds3',
  120.     31,' sip',
  121.     32,' frame-relay'
  122. );
  123.  
  124. %ifAdminStatus2a = (1,'up',2,'down',3,'testing');
  125. %ifOperStatus2a = %ifAdminStatus2a ;
  126.  
  127. %ifRouteType2a=(1,'other',2,'invalid',3,'direct',4,'remote');
  128.  
  129. %ipNetToMediaType2a=(1,'other',2,'invalid',3,'dynamic',4,'static');
  130.  
  131. %tcpConnState2a=(1,'closed',2,'listen',3,'synSent',4,'synReceived',
  132.           5,'established',6,'finWait1',7,'finWait2',8,'closeWait',
  133.           9,'lastAck',10,'closing',11,'timeWait');
  134.  
  135. %ipForwarding2a=(1,'gateway',2,'host');
  136.  
  137. %tcpRtoAlgorithm2a = (1,'other',2,'constant',3,'rsre',4,'vanj');
  138.  
  139. sub sysServices2a {
  140.   local($x) = @_;
  141.   local($result);
  142.  
  143.   $result .= "physical, " if ($x & 1);
  144.   $result .= "data-link, " if ($x & 2);
  145.   $result .= "internet, " if ($x & 4);   
  146.   $result .= "end-to-end, " if ($x & 8); 
  147.   $result .= "application, " if ($x & 64);
  148.  
  149.   $result =~ s/, $//;
  150.   return $result;
  151. }
  152.  
  153. sub timeTicks2a {
  154.   local($ticks)= @_;
  155.   local($d,$h,$m,$s,$result);
  156.   
  157.   $ticks /= 100;
  158.  
  159.   $d = int($ticks / (60 * 60 * 24));
  160.   $ticks %= (60*60*24);
  161.  
  162.   $h = int($ticks / (60 * 60));
  163.   $ticks %= (60*60);
  164.  
  165.   $m = int($ticks/60);
  166.   $s = $ticks % 60;
  167.  
  168.   $result = sprintf("%d:%02d:%02d",$h,$m,$s);
  169.   if ($d==1) {
  170.         $result = sprintf("%d day ",$d) . $result;
  171.   } elsif ($d>1) {
  172.         $result = sprintf("%d days ",$d) . $result;
  173.   }
  174.   return $result;
  175.  
  176. }
  177.  
  178. sub hexString2a {
  179.    local($string) = @_;
  180.    local($result,$n);
  181.      
  182.    foreach (split(/:/,$string)) {
  183.        $n = oct("0x$_");
  184.        last if !$n;
  185.        $result .= sprintf("%c",$n);
  186.    }
  187.    $result;
  188. }
  189.  
  190. sub dump_system {
  191.  
  192.   local($host) = @_;
  193.   local(*int);
  194.  
  195.   &get_table($host,"system",*int);
  196.  
  197.     print "\n";
  198.     print "Host: $host\nDate: $date\n";
  199.     print "\n";
  200.     print " "*30,"System Table\n";
  201.     print "System Description\n  ", $int{"sysDescr[0]"},"\n\n";
  202.     print "UpTime       ", &timeTicks2a($int{"sysUpTime[0]"}),"\n";
  203.     print "ObjectID     ", $int{"sysObjectID[0]"},"\n";
  204.     $sysName =  $int{"sysName[0]"};
  205.     $sysContact = $int{"sysContact[0]"};
  206.     $sysLocation = $int{"sysLocation[0]"};
  207.     $sysServices = $int{"sysServices[0]"};
  208.     if ($sysName || $sysContact || $sysLocation || $sysServices) {
  209.     print "Name         $sysName\n";
  210.     print "Contact      $sysContact\n";
  211.     print "Location     $sysLocation\n";
  212.     print "Services     ",&sysServices2a($sysServices),"\n";
  213.     }
  214.     print "\n";
  215. }
  216.  
  217. sub dump_interface {
  218.   local($host) = @_;
  219.   local(*int);
  220.  
  221.   &get_table($host,"interfaces",*int);
  222.  
  223.   $number = $int{"ifNumber[0]"};
  224.     print "\n";
  225.     print "Host: $host\nDate: $date\n";
  226.     print "\n";
  227.     print " "*30,"Interface Table\n";
  228.     print "\n";
  229.  
  230.     print "Number of interfaces = $number\n";
  231.  
  232.   for ($i=1; $i <= $number; $i++) {
  233.     print "\n";
  234.    print "-"*40,"Interface $i\n";
  235.     $ifIndex = $int{"ifIndex[$i]"};
  236.     $ifDescr = &hexString2a($int{"ifDescr[$i]"});
  237.     $ifType  = $ifType2a{$int{"ifType[$i]"}};
  238.     $ifMtu   = $int{"ifMtu[$i]"};
  239.     $ifSpeed = $int{"ifSpeed[$i]"};
  240.     $ifPhysAddress = $int{"ifPhysAddress[$i]"};
  241.     $ifAdminStatus = $ifAdminStatus2a{$int{"ifAdminStatus[$i]"}};
  242.     $ifOperStatus  = $ifOperStatus2a{$int{"ifOperStatus[$i]"}};
  243.     $ifLastChange  = &timeTicks2a($int{"ifLastChange[$i]"});
  244.     $ifInOctets = $int{"ifInOctets[$i]"}+0;
  245.     $ifInUcastPkts = $int{"ifInUcastPkts[$i]"}+0;
  246.     $ifInNUcastPkts = $int{"ifInNUcastPkts[$i]"}+0;
  247.     $ifInDiscards =  $int{"ifInDiscards[$i]"}+0;
  248.     $ifInErrors = $int{"ifInErrors[$i]"}+0;
  249.     $ifInUnknownProtos = $int{"ifInUnknownProtos[$i]"}+0;
  250.     $ifOutOctets = $int{"ifOutOctets[$i]"}+0;
  251.     $ifOutUcastPkts = $int{"ifOutUcastPkts[$i]"}+0;
  252.     $ifOutNUcastPkts =$int{"ifOutNUcastPkts[$i]"}+0;
  253.     $ifOutDiscards = $int{"ifOutDiscards[$i]"}+0;
  254.     $ifOutErrors = $int{"ifOutErrors[$i]"}+0;
  255.     $ifOutQlen =  $int{"ifOutQlen[$i]"}+0;
  256. print "\n";
  257. if ($ifDescr) {  
  258. printf("Description     %s (%d)\n",$ifDescr,$ifIndex); 
  259. }
  260. else          {  
  261. printf("Description     (%d)\n",$ifIndex); 
  262. }
  263. printf("Address         $ifPhysAddress\n");
  264. printf("Type            %s\n",$ifType);
  265. printf("Mtu             %s\n",$ifMtu);
  266. printf("Speed           %s (%s)\n",$ifSpeed,int($ifSpeed/1000000)." MBS");
  267. printf("Status          %s",$ifOperStatus);
  268. if ($ifAdminStatus ne $ifOperStatus) { 
  269.       printf("(desired state: $ifAdminStatus)"); 
  270.  
  271. }
  272. if ($int{"ifLastChange[$i]"}) { print "(last config change: $ifLastChange)";}
  273. printf("\n");
  274. printf("Unknwn Proto    %s\n",$ifInUnknownProtos);
  275. printf("Output Q len    %s\n",$ifOutQlen);
  276.  
  277.  
  278. printf("Input\n");
  279. printf("  Octects       %d\n",$ifInOctects);
  280. printf("  unicast       %d\n",$ifInUcastPkts);
  281. printf("  broad/multi   %d\n",$ifInNUcastPkts);
  282. printf("  discards      %d\n",$ifInDiscards);
  283. printf("  errors        %d\n",$ifInErrors);
  284. printf("Output\n");
  285. printf("  Octects       %d\n",$ifOutOctets);
  286. printf("  unicast       %d\n",$ifOutUcastPkts);
  287. printf("  broad/multi   %d\n",$ifOutNUcastPkts);
  288. printf("  discards      %d\n",$ifOutDiscards);
  289. printf("  errors        %d\n",$ifOutErrors);
  290.  
  291.  
  292.   }
  293. }
  294.  
  295. sub dump_at {
  296.  
  297.   local($host) = @_;
  298.   local(*at);
  299.  
  300.   &get_table($host,"at",*at);
  301.  
  302.     print "\n";
  303.     print "Host: $host\nDate: $date\n";
  304.     print "\n";
  305.     print "       Address Translation Group\n";
  306.     print "\n";
  307.  
  308.     printf("%8s %17s       %s\n","Interface","Physical Addr","IP Addr");
  309.  
  310.   foreach (keys %at) {
  311.  
  312.       if (/^atIfIndex\[([^]]*)/) {
  313.          $_ = $index = $1;
  314.          ($if,$ip) = /(\d+)\.\d+\.(.*)/;
  315.          printf("   %2d       %s    %s\n",$if,$at{"atPhysAddress[$index]"},$ip);
  316.       }
  317.   }
  318.     print "\n";
  319. }
  320.  
  321.  
  322. sub dump_ip {
  323.  
  324.   local($host) = @_;
  325.   local(*ip);
  326.  
  327.   &get_table($host,"ip",*ip);
  328.  
  329.     print "\n";
  330.     print "Host: $host\nDate: $date\n";
  331.     print "\n";
  332.     print " "*10,"IP Group\n";
  333.  
  334.   print "\n";
  335.   print "Forwarding          ",$ipForwarding2a{$ip{"ipForwarding[0]"}},"\n";
  336.   print "Default TTL         ",$ip{"ipDefaultTTL[0]"}+0,"\n";
  337.   print "Input\n";
  338.   print "  Datagrams         ",$ip{"ipInReceives[0]"}+0,"\n";
  339.   print "  Hardware Err      ",$ip{"ipInHdrErrors[0]"}+0,"\n";
  340.   print "  Address Err       ",$ip{"ipInAddrErrors[0]"}+0,"\n";
  341.   print "  Unknown Proto     ",$ip{"ipInUnknownProtos[0]"}+0,"\n";
  342.   print "  Discards          ",$ip{"ipInDiscards[0]"}+0,"\n";
  343.   print "  Delivers          ",$ip{"ipInDelivers[0]"}+0,"\n";
  344.   print "Output\n";
  345.   print "  Datagrams         ",$ip{"ipOutReceives[0]"}+0,"\n";
  346.   print "  Discards          ",$ip{"ipOutDiscards[0]"}+0,"\n";
  347.   print "  No Routes         ",$ip{"ipOutNoRoutes[0]"}+0,"\n";
  348.   print "Reassembly\n";
  349.   print "  Timeout           ",$ip{"ipReasmTimeout[0]"}+0,"\n";
  350.   print "  Requests          ",$ip{"ipReasmReqds[0]"}+0,"\n";
  351.   print "  OK                ",$ip{"ipReasmOKs[0]"}+0,"\n";
  352.   print "  Fail              ",$ip{"ipReasmFails[0]"}+0,"\n";
  353.   print "Frags\n";
  354.   print "  OK                ",$ip{"ipFragOKs[0]"}+0,"\n";
  355.   print "  Fail              ",$ip{"ipFragFails[0]"}+0,"\n";
  356.   print "  Created           ",$ip{"ipFragCreates[0]"}+0,"\n";
  357.   print "Forwarded Datagrams ",$ip{"ipForwDatagrams[0]"}+0,"\n";
  358.  
  359.   $done=0;
  360.   foreach (keys %ip) {
  361.  
  362.       if (/^ipAdEntAddr\[([^]]*)/) {
  363.     if (!$done) {
  364.     print "\n";
  365.          print " "*20,"IP Interface Address Table\n";
  366.          printf("%s  %-15s %-15s %-15s  %s\n",
  367.          "Interface","IP address","Net Mask","Broadcast","Reasm Max (mib II)");
  368.          $done=1;
  369.     }
  370.          $_ = $1;
  371.          printf("  %2d       %-15s %-15s %-15s  %s\n",
  372.         $ip{"ipAdEntIfIndex[$_]"},
  373.                 $_,
  374.         $ip{"ipAdEntNetMask[$_]"},
  375.         $ip{"ipAdEntBcastAddr[$_]"},
  376.         $ip{"ipAdEntReasmMaxSize[$_]"});
  377.       }
  378.   }
  379.  
  380.   $done=0;
  381.   foreach (keys %ip) {
  382.  
  383.       if (/^ipRouteDest\[([^]]*)/) {
  384.     if (!$done) {
  385.     print "\n";
  386.          print " "*25,"Routing Table\n";
  387.  
  388.          printf("%-15s %7s  %-15s %-7s  %s\n","Destination","Interface","Next Hop","Type","Mask (mib II)");
  389.          $done=1;
  390.     }
  391.          $_ = $1;
  392.          printf("%-15s    %2d      %-15s %-7s  %s\n",
  393.                 $_,
  394.         $ip{"ipRouteIfIndex[$_]"},
  395.         $ip{"ipRouteNextHop[$_]"},
  396.         $ifRouteType2a{$ip{"ipRouteType[$_]"}},
  397.         $ip{"ipRouteMask[$_]"});
  398.       }
  399.   }
  400.  
  401. $done=0;
  402.   foreach (keys %ip) {
  403.       if (/^ipNetToMediaIfIndex\[([^]]*)/) {
  404. if (!$done) {
  405.          print "\n";
  406.          print " "*15,"Net to Media Table (ARP cache)\n";
  407.          printf(" %s   %-17s    %-15s  %s\n",
  408.            "Interface","Physical Address","IP Address","Type");
  409.    $done=1;
  410. }
  411.          $index = $_ = $1;
  412.          ($if,$ip) = /(\d+)\.(.*)/;
  413.          printf("   %2d        %-17s    %-15s  %s\n",
  414.                 $if,
  415.         $ip{"ipNetToMediaPhysAddress[$index]"},
  416.                 $ip,
  417.         $ipNetToMediaType2a{$ip{"ipNetToMediaType[$index]"}});
  418.       }
  419.   }
  420.     print "\n";
  421.  
  422. }
  423.  
  424.  
  425. sub dump_tcp {
  426.  
  427.   local($host) = @_;
  428.   local(*tcp);
  429.  
  430.   &get_table($host,"tcp",*tcp);
  431.  
  432.     print "\n";
  433.     print "Host: $host\nDate: $date\n";
  434.     print "\n";
  435.     print "       TCP Group\n";
  436.     print "\n";
  437. print "Retrans Algorithm    ",$tcpRtoAlgorithm2a{$tcp{"tcpRtoAlgorithm[0]"}},"\n";
  438. print "Retrans Min Timeout  ",$tcp{"tcpRtoMin[0]"},"\n";
  439. print "Retrans Max Timeout  ",$tcp{"tcpRtoMax[0]"},"\n";
  440. print "Max Connections      ",$tcp{"tcpMaxConn[0]"},"\n";
  441. print "Active Opens         ",$tcp{"tcpActiveOpens[0]"},"\n";
  442. print "Passive Opens        ",$tcp{"tcpPassiveOpens[0]"},"\n";
  443. print "Attempt Fails        ",$tcp{"tcpAttemptFails[0]"},"\n";
  444. print "Connection Resets    ",$tcp{"tcpEstabResets[0]"},"\n";
  445. print "Current Connections  ",$tcp{"tcpCurrEstab[0]"},"\n";
  446. print "Input Segments       ",$tcp{"tcpInSegs[0]"},"\n";
  447. print "Output Segments      ",$tcp{"tcpOutSegs[0]"},"\n";
  448. print "Retrans Segments     ",$tcp{"tcpRetransSegs[0]"},"\n";
  449. print "Input Errors         ",$tcp{"tcpInErrs[0]"},"\n";
  450. print "Output Resets        ",$tcp{"tcpOutRsts[0]"},"\n";
  451.  
  452.     print "\n";
  453. print " "*20,"TCP Connection Table\n";
  454. print " "*10,"Local "," "*20,"Remote\n";
  455.          printf("%-15s %5s      %-15s %5s    %s\n",
  456.                "Address","Port","Address","Port","State");
  457.   foreach (keys %tcp) {
  458.  
  459.       if (/^tcpConnState\[([^]]*)/) {
  460.          $_ = $index = $1;
  461.          ($lip,$lp,$rip,$rp) = 
  462.               /(\d+\.\d+\.\d+\.\d+)\.(\d+)\.(\d+\.\d+\.\d+\.\d+)\.(\d+)/;
  463.               $tcpConnState = $tcpConnState2a{$tcp{"tcpConnState[$index]"}};
  464.          printf("%-15s %5d      %-15s %5d    %s\n",
  465.                     $lip,$lp,$rip,$p,$tcpConnState);
  466.       }
  467.   }
  468.     print "\n";
  469. }
  470.  
  471.  
  472. sub dump_udp {
  473.  
  474.   local($host) = @_;
  475.   local(*udp);
  476.  
  477.   &get_table($host,"udp",*udp);
  478.  
  479.     print "\n";
  480.     print "Host: $host\nDate: $date\n";
  481.     print "\n";
  482.     print "       UDP Group\n";
  483.     print "\n";
  484.  
  485.     print "Input Datagrams   ", $udp{"udpInDatagrams[0]"}+0,"\n";
  486.     print "Input Errors      ", $udp{"udpInErrors[0]"}+0,"\n";
  487.     print "Unknown Dest Port ", $udp{"udpNoPorts[0]"}+0,"\n";
  488.     print "Output Datagrams  ", $udp{"udpOutDatagrams[0]"}+0,"\n";
  489.  
  490.   foreach (keys %udp) {
  491.  
  492.       if (/^udpLocalPort\[([^]]*)/) {
  493. if (!$done) {
  494.     print "\n";
  495. print " "*10,"UDP Table\n";
  496.          printf("%-15s %5s\n","Local Address","Local Port");
  497.  $done=1;
  498. }
  499.          $_ = $index = $1;
  500.          ($lip,$lp) =/(\d+\.\d+\.\d+\.\d+)\.(\d+)/;
  501.          printf("%-15s    %5d\n",$lip,$lp);
  502.       }
  503.   }
  504.     print "\n";
  505. }
  506.  
  507.  
  508.  
  509. sub dump_icmp {
  510.  
  511.   local($host) = @_;
  512.   local(*icmp);
  513.  
  514.   &get_table($host,"icmp",*icmp);
  515.  
  516.     print "\n";
  517.     print "Host: $host\nDate: $date\n";
  518.     print "\n";
  519.     print " "*30,"ICMP Group\n";
  520.  
  521.     print "\n";
  522.     printf("                           Input         Output\n");
  523.     printf(" Messages           %12d   %12d\n", $icmp{"icmpInMsgs[0]"}, $icmp{"icmpOutMsgs[0]"});
  524.     printf(" Errors             %12d   %12d\n", $icmp{"icmpInErrors[0]"}, $icmp{"icmpOutErrors[0]"});
  525.     printf(" Dest unreach       %12d   %12d\n", $icmp{"icmpInDestUnreachs[0]"}, $icmp{"icmpOutDestUnreachs[0]"});
  526.     printf(" Time exceeds       %12d   %12d\n", $icmp{"icmpInTimeExcds[0]"}, $icmp{"icmpInTOuteExcds[0]"});
  527.     printf(" Parm problems      %12d   %12d\n", $icmp{"icmpInParmProbs[0]"}, $icmp{"icmpOutParmProbs[0]"});
  528.     printf(" Source Quenchs     %12d   %12d\n", $icmp{"icmpInSrcQuenchs[0]"}, $icmp{"icmpOutSrcQuenchs[0]"});
  529.     printf(" Redirects          %12d   %12d\n", $icmp{"icmpInRedirects[0]"}, $icmp{"icmpInRedOutects[0]"});
  530.     printf(" Echos              %12d   %12d\n", $icmp{"icmpInEchos[0]"}, $icmp{"icmpOutEchos[0]"});
  531.     printf(" Echo reps          %12d   %12d\n", $icmp{"icmpInEchoReps[0]"}, $icmp{"icmpOutEchoReps[0]"});
  532.     printf(" Timestamps         %12d   %12d\n", $icmp{"icmpInTimestamps[0]"}, $icmp{"icmpInTOutestamps[0]"});
  533.     printf(" Timestamp reps     %12d   %12d\n", $icmp{"icmpInTimestampReps[0]"}, $icmp{"icmpInTOutestampReps[0]"});
  534.     printf(" Address masks      %12d   %12d\n", $icmp{"icmpInAddrMasks[0]"}, $icmp{"icmpOutAddrMasks[0]"});
  535.     printf(" Address mask reps  %12d   %12d\n", $icmp{"icmpInAddrMaskReps[0]"}, $icmp{"icmpOutAddrMaskReps[0]"});
  536.  
  537.  
  538.  
  539.     print "\n";
  540. }
  541.  
  542.  
  543. sub get_table { 
  544.     local($host,$t,*table) = @_;
  545.  
  546.  open(SNMP,"echo '$t\[]' | $snmp_table $host|");
  547.  while(<SNMP>) {
  548.     chop;
  549.     /^(.*)=(.*)$/;
  550.     $table{$1} = $2;
  551.  }
  552. }
  553.  
  554.  
  555. 1;
  556.